import { message } from 'ant-design-vue/es'
import themeColor from './themeColor.js'

const colorList = [
  {
    key: '薄暮', color: '#f5222d'
  },
  {
    key: '火山', color: '#fa541c'
  },
  {
    key: '日暮', color: '#faad14'
  },
  {
    key: '明青', color: '#13c2c2'
  },
  {
    key: '极光绿', color: '#52c41a'
  },
  {
    key: '拂晓蓝（默认）', color: '#1890ff'
  },
  {
    key: '极客蓝', color: '#2f54eb'
  },
  {
    key: '酱紫', color: '#722ed1'
  }
]

const updateTheme = newPrimaryColor => {
  const hideMessage = message.loading('正在切换主题！', 0)
  themeColor.changeColor(newPrimaryColor).finally(() => {
    hideMessage()
  })
}

const updateColorWeak = colorWeak => {
  // document.body.className = colorWeak ? 'colorWeak' : '';
  colorWeak ? document.body.classList.add('colorWeak') : document.body.classList.remove('colorWeak')
}

export { updateTheme, colorList, updateColorWeak }